//
//  AboutUsTableViewCell.m
//  AnXin100
//
//  Created by 王合润 on 10/18/18.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "AboutUsTableViewCell.h"

@interface AboutUsTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconImage;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *desLabel;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageWidth;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *lableSpace;
@end

@implementation AboutUsTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    if ([_dataDic[@"icon"] length] == 0) {
        _imageWidth.constant
        = 0;
        _lableSpace.constant = 5;
    }
}

- (void)setDataDic:(NSDictionary *)dataDic {
    _dataDic = dataDic;
    _iconImage.image = [UIImage imageNamed:dataDic[@"icon"]];
    _titleLabel.text = dataDic[@"title"];
    _desLabel.text = dataDic[@"des"];
    NSMutableParagraphStyle *paraStyle01 = [[NSMutableParagraphStyle alloc] init];
    paraStyle01.alignment = NSTextAlignmentLeft;  //对齐
    paraStyle01.headIndent = 0.0f;//行首缩进
    //参数：（字体大小17号字乘以2，34f即首行空出两个字符）
    CGFloat emptylen = self.desLabel.font.pointSize * 2;
    paraStyle01.firstLineHeadIndent = emptylen;//首行缩进
    paraStyle01.tailIndent = 0.0f;//行尾缩进
//    paraStyle01.lineSpacing = 2.0f;//行间距
    
    NSAttributedString *attrText = [[NSAttributedString alloc] initWithString:dataDic[@"des"] attributes:@{NSParagraphStyleAttributeName:paraStyle01}];
    self.desLabel.attributedText = attrText;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
